﻿// <copyright file="OneByteSensorTelegram.cs" company="Hallvard Korsgaard">
//  Microsoft Public License (Ms-PL). See license details here: http://enoceannet.codeplex.com/license
// </copyright>
// <author>Hallvard Korsgaard</author> 

namespace EnOcean.Radio.Sensor
{
  using System;

  /// <summary>
  /// Represents a 1 byte data telegram (ORG = 0x06).
  /// </summary>
  [Serializable]
  public class OneByteSensorTelegram : SensorTelegram
  {
    /// <summary>
    /// Gets or sets the data byte.
    /// </summary>
    public byte Data
    {
      get;
      set;
    }

    /// <summary>
    /// Creates the byte format of the message.
    /// </summary>
    /// <param name="message">A byte array of length 14 to hold the message contents.</param>
    protected internal override void CreateMessage(byte[] message)
    {
      base.CreateMessage(message);
      message[3] = (byte)Org.OneByteSensor; // Org
      message[4] = this.Data;  // Data 3
    }
  }
}
